﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace zUfDsl
{
    public partial class FrmMessage : Form
    {
        public FrmMessage()
        {
            InitializeComponent();
            this.Icon = Properties.Resources.Fly1;
        }

        public void SetMsg(bool bret, string txtCaption, string txtDetail)
        {
            if (bret) { pictureBox1.Image = Properties.Resources.Suc; }
            else { pictureBox1.Image = Properties.Resources.Err; }
            this.LabCaption.Text = txtCaption;
            this.tbTip.Text = txtDetail;
            FrmMessageResize(null, null);
        }
        /// <summary>
        /// 显示信息提示窗口
        /// </summary>
        public void ShowMsg(bool bret, string txtCaption, string txtDetail)
        {
            SetMsg(bret, txtCaption, txtDetail);
            ShowDialog();
        }

        private void btCloseClick(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmMessageResize(object sender, EventArgs e)
        {
            if (this.Height > 230)
            {
                this.tbTip.Height = this.Height - 230;
                this.btClose.Top = this.tbTip.Top + this.tbTip.Height + 10;
            }
            if (this.Width > 200)
            {
                this.tbTip.Width = this.Width - 150;
                this.LabCaption.Width = this.Width - 150;
            }
        }
    }
}
